package com.qding.park.manager.rest.controller.wx;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.bind.annotation.RestController;

import com.qding.park.manager.rest.controller.WebBaseController;

/**
  * @ClassName: WX_Controller
  * @Description: 微信 页面有关的接口
  * @author Comsys-Administrator
  * @date 2016年10月17日 上午10:19:47
  *
  */
@RestController
public class WX_Car_Controller extends WebBaseController{
	private static final Log _log = LogFactory.getLog(WX_Car_Controller.class);
	
//	@Autowired
//	private CarCommonFacade carCommonFacade;
	
	
	/**
	  * wx_mycars(查询用户名下的车辆列表)
	  * TODO(这里描述这个方法适用条件 – 可选)
	  * TODO(这里描述这个方法的执行流程 – 可选)
	  * TODO(这里描述这个方法的使用方法 – 可选)
	  * TODO(这里描述这个方法的注意事项 – 可选)
	  *
	  * @Title: wx_mycars
	  * @Description: TODO
	  * @param @param phone  手机号
	  * @param @param userId  微信用户名
	  * @param @return    设定文件
	  * @return AnswerMsg    返回类型
	  * @throws
	  */
//	@RequestMapping("/wx/car/myCars")
//	public AnswerMsg wx_mycars(String phone, String userId) {
//			
//		try {
//			/******验证字段********/
//			RchlValidateBean vb = new RchlValidateBean();
//			vb.getPhoneValidate().put("phone", phone);
//			vb.getRequiredValidate().put("userId", userId);
//			RchlValidateTools.validate(vb);
//			/**************/
//			
//			ParkDataResult parkDataResult = carFacade.mycars_wx(Long.valueOf(phone), userId);
//			AnswerMsg answerMsg = AnswerMsgFactoryImpl.createAnswerMsg(parkDataResult.getData());
//			return answerMsg;
//		}catch(RchlValidatorException e){
////			e.getExceptionMessage().appendDetailText("CarController.myCars:"+"userId="+userId+",phone"+phone);
//			exceptionHandle.handle(e);
//			AnswerMsg answerMsg = AnswerMsgFactoryImpl.createErrorAnserMsg(ResponseCodeEnum.VALIDATION_ERROR.getValue(),
//					e.getExceptionMessage().getSimpleText()+";"+e.getExceptionMessage().getDetailText());
//			return answerMsg;
//		}catch(BaseException e){
//			exceptionHandle.handle(e);
//			AnswerMsg answerMsg = AnswerMsgFactoryImpl.createErrorAnserMsg(ResponseCodeEnum.BUSINESS_ERROR.getValue(),
//					e.getExceptionMessage().getName()+e.getExceptionMessage().getSimpleText());
//			return answerMsg;
//		}catch (Exception e) {
//			SystemUnKnown ex=new SystemUnKnown(e,
//					ExceptionMessage.createExceptionMessage(SystemUnKnown.default_Name,
//														"未知Exception", "userId="+userId+",phone="+phone));
//			exceptionHandle.handle(ex);
//			AnswerMsg answerMsg = AnswerMsgFactoryImpl.createErrorAnserMsg(ResponseCodeEnum.SYSTEM_ERROR);
//			return answerMsg;
//		}
//	}
	
//	@RequestMapping("/wx/car/addCar")
//	public AnswerMsg wx_addCar(String phone, String userId,String carNum) {
//			
//		try {
//			/******验证字段********/
//			RchlValidateBean vb = new RchlValidateBean();
//			vb.getPhoneValidate().put("phone", phone);
//			vb.getRequiredValidate().put("userId", userId);
//			vb.getRequiredValidate().put("carNum", carNum);
//			RchlValidateTools.validate(vb);
//			/**************/
//			
//			ParkDataResult parkDataResult = carFacade.addCar_wx(Long.valueOf(phone),userId, carNum);
//			AnswerMsg answerMsg = AnswerMsgFactoryImpl.createAnswerMsg(parkDataResult.getData());
//			return answerMsg;
//		}catch(RchlValidatorException e){
////			e.getExceptionMessage().appendDetailText("CarController.myCars:"+"userId="+userId+",phone"+phone);
//			exceptionHandle.handle(e);
//			AnswerMsg answerMsg = AnswerMsgFactoryImpl.createErrorAnserMsg(ResponseCodeEnum.VALIDATION_ERROR.getValue(),
//					e.getExceptionMessage().getSimpleText()+";"+e.getExceptionMessage().getDetailText());
//			return answerMsg;
//		}catch(BaseException e){
//			exceptionHandle.handle(e);
//			AnswerMsg answerMsg = AnswerMsgFactoryImpl.createErrorAnserMsg(ResponseCodeEnum.BUSINESS_ERROR.getValue(),
//					e.getExceptionMessage().getSimpleText());
//			return answerMsg;
//		}catch (Exception e) {
//			SystemUnKnown ex=new SystemUnKnown(e,
//					ExceptionMessage.createExceptionMessage(SystemUnKnown.default_Name,
//														"未知Exception", "userId="+userId+",phone="+phone));
//			exceptionHandle.handle(ex);
//			AnswerMsg answerMsg = AnswerMsgFactoryImpl.createErrorAnserMsg(ResponseCodeEnum.SYSTEM_ERROR);
//			return answerMsg;
//		}
//	}
	
//	@RequestMapping("/wx/car/deleteCar")
//	public AnswerMsg wx_deleteCar(String phone, String userId,String carNum) {
//		try {
//			/******验证字段********/
//			RchlValidateBean vb = new RchlValidateBean();
//			vb.getPhoneValidate().put("phone", phone);
//			vb.getRequiredValidate().put("userId", userId);
//			vb.getRequiredValidate().put("carNum", carNum);
//			RchlValidateTools.validate(vb);
//			/**************/
//			
//			ParkDataResult parkDataResult = carFacade.deleteCar_wx(Long.valueOf(phone),userId, carNum);
//			AnswerMsg answerMsg = AnswerMsgFactoryImpl.createAnswerMsg(parkDataResult.getData());
//			return answerMsg;
//		}catch(RchlValidatorException e){
////			e.getExceptionMessage().appendDetailText("CarController.myCars:"+"userId="+userId+",phone"+phone);
//			exceptionHandle.handle(e);
//			AnswerMsg answerMsg = AnswerMsgFactoryImpl.createErrorAnserMsg(ResponseCodeEnum.VALIDATION_ERROR.getValue(),
//					e.getExceptionMessage().getSimpleText()+";"+e.getExceptionMessage().getDetailText());
//			return answerMsg;
//		}catch(BaseException e){
//			exceptionHandle.handle(e);
//			AnswerMsg answerMsg = AnswerMsgFactoryImpl.createErrorAnserMsg(ResponseCodeEnum.BUSINESS_ERROR.getValue(),
//					e.getExceptionMessage().getName()+e.getExceptionMessage().getSimpleText());
//			return answerMsg;
//		}catch (Exception e) {
//			SystemUnKnown ex=new SystemUnKnown(e,
//					ExceptionMessage.createExceptionMessage(SystemUnKnown.default_Name,
//														"未知Exception", "userId="+userId+",phone="+phone));
//			exceptionHandle.handle(ex);
//			AnswerMsg answerMsg = AnswerMsgFactoryImpl.createErrorAnserMsg(ResponseCodeEnum.SYSTEM_ERROR);
//			return answerMsg;
//		}
//	}
}
